By combining extension functions and custom accessors, we get extension properties.
Here, we are adding a something
extension property to a Map<String, T>
for a
declared generic type T
. We
can then reference something
on such a Map
, as if something
were implemented
on Map
itself.
The syntax is reminiscent of extension functions, in that we use ClassName.propertyName
to scope the extension property to the designated class. And, we have to use a
custom getter to define the implementation of how to obtain the value of this property.
You can learn more about this in:
Tags: